package com.logic.modular.game.draw.mapper;

import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.logic.modular.game.draw.domain.PlayerDraw;

/**
 * 玩家抽卡信息(PlayerDraw)表数据库访问层
 *
 * @author cxy
 * @since 2024-08-08 10:42:41
 */
public interface PlayerDrawMapper extends BaseMapper<PlayerDraw> {
    @Override
    default int updateById(PlayerDraw entity) {
        Long uid = entity.getUid();
        Long type = entity.getType();
        Integer lv = entity.getLv();
        if (uid == null || type == null || lv == null) {
            throw new RuntimeException("参数错误");
        }
        LambdaQueryWrapper<PlayerDraw> wrapper = new LambdaQueryWrapper<>();
        wrapper.eq(PlayerDraw::getType, type);
        wrapper.eq(PlayerDraw::getUid, uid);
        wrapper.eq(PlayerDraw::getLv, lv);
        return this.update(entity, wrapper);
    }

}

